package cn.loioi.test.common;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import org.xutils.view.annotation.Event;
import org.xutils.view.annotation.ViewInject;

import cn.loioi.test.R;


/**
 * (c) Copyright 2016 by
 *
 * @author :loioi
 * @description :
 * @创建时间 :2016/4/4 12:55
 */
public class HeadBaseActivity extends TestBaseActivity {
    @ViewInject(R.id.head_nav_title_text)
    private TextView headNavTitleText;

    @ViewInject(R.id.head_nav_back_btn)
    private ImageView headNavBackBtn;

    @Event(R.id.head_nav_back_btn)
    private void head_nav_back_btn(View view) {
        onBackPressed();
    }

    /**
     * 设置标题
     *
     * @param title
     */
    protected void setTitleText(String title) {
        headNavTitleText.setText(title);
    }

    /**
     * 获取标题文字
     *
     * @return
     */
    protected String getTitleText() {
        return headNavTitleText.getText().toString();
    }


    /**
     * 设置返回按钮是否显示
     *
     * @param show true:显示/false:隐藏
     */
    protected void showBackBtn(boolean show) {
        headNavBackBtn.setVisibility(show ? View.VISIBLE : View.GONE);
    }
}
